import { IModalProps } from '@/interfaces/common';
import { IReferenceChunk } from '@/interfaces/database/chat';
import { IChunk } from '@/interfaces/database/knowledge';
import { Drawer } from 'antd';
import './index.less'

interface IProps extends IModalProps<any> {
  MsgList: any;
  activeIndex: number;
  handleMsgListItem: (content: string) => void;
}

export const MsgDrawer = ({
  visible = false,
  hideModal,
  MsgList,
  activeIndex,
  handleMsgListItem
}: IProps) => {
  return (
    <Drawer
      title="消息列表"
      placement='left'
      onClose={hideModal}
      open={visible}
      width={'50vw'}
    >
      {
        <div className='documentContainer'>
          {
            MsgList.map((item:any, index:number) => {
              if(item.role === 'user'){
                  return (
                  <div key={index}
                    className={['msg-list-item',index !== 0 ? 'pt-line' : ''].join(' ')}
                    onClick={() => handleMsgListItem(item.content)}
                    >{item.content}</div>
                )
              }
            })
          }
        </div>
      }
    </Drawer>
  );
};

export default MsgDrawer;
